package com.bs.service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bs.entity.EmployeeInfo;
import com.bs.mapper.EmployeeInfoMapper;
import org.springframework.stereotype.Service;

import java.util.Objects;

@Service
public class EmployeeInfoService extends ServiceImpl<EmployeeInfoMapper, EmployeeInfo> {
    public Boolean saveEmployeeInfo(EmployeeInfo employeeInfo) {
        EmployeeInfo newEmployee = getById(employeeInfo.getId());

        // 待修改 添加员工和编辑员工逻辑
        if(Objects.isNull(newEmployee)){
            return save(employeeInfo);
        }else if(newEmployee.getName().equals(employeeInfo.getName())) {
            return updateById(employeeInfo);
        }else {
            return false;
        }
//        return saveOrUpdate(employeeInfo);
    }
}
